reusable routine

Học thuật
Thân thiện
reusable routine

A programmer writes a reusable routine to sort data.

Definition

Noun: A reusable routine is a self-contained block of code or a set of instructions designed to perform a specific task. Its key characteristic is that it can be written once, stored in a library or module, and then invoked or "called" multiple times from different parts of a program without needing to be rewritten.

Usage

This term is used in computer programming and software engineering. It describes a fundamental principle of writing efficient and maintainable code. * The programmer created a reusable routine to validate user input, which was then used by every form in the application. * One major advantage of object-oriented design is the creation of reusable routines that can be inherited by different classes.

Advanced Usage
  • As a design goal: The concept promotes the "Don't Repeat Yourself" (DRY) principle. Writing reusable routines reduces errors, saves development time, and makes software easier to update.
    • The team's focus was on developing a library of reusable routines for common mathematical calculations.
  • In contrast to one-time code: It is often contrasted with code written for a single, specific purpose that is not designed for reuse.
    • The script contained a lot of duplicated logic that should have been refactored into a reusable routine.
Variants and Related Words
  • Function: A common type of reusable routine that takes inputs, performs operations, and returns a value.
  • Procedure / Subroutine: Similar to a function, often implying it performs an action but may not return a value.
  • Method: A reusable routine that is associated with an object or a class in object-oriented programming.
  • Module: A file or collection that contains one or more reusable routines.
  • Library: A collection of pre-written reusable routines.
Synonyms
  • Callable unit
  • Code module (in a specific context)
  • Subprogram
Related Phrases
  • Code reuse: The general practice of using existing software or routines to build new systems.
    • The project's success was largely due to a high degree of code reuse from previous libraries.
  • To call a routine: To execute or invoke a reusable routine from within a program.
    • The main program calls the routine whenever data needs to be sorted.
reusable routine

A programmer writes a reusable routine to sort data.

Noun
  1. a routine that can be loaded once and executed repeatedly